#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "interface.h"
#include <sys/ioctl.h>


int  get_light()
{
	int i;
	int fd = open("/dev/photosensor_dev", O_RDWR);
	if (fd == -1 ) 
	{
		perror("open");
		printf("error: can't open file /dev/photosensor_dev\n");
		return -1;
	}
	i = ioctl(fd,LIGHT_L);
	
	if(1 == i )
	{
		return i;
	}
	else
	{
		return i;
	}

	close(fd);
		
	return -1;
}

